﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;


namespace JSMS.Filter
{
    public class IsLoginFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        { 
            string role = filterContext.HttpContext.Session["role"] as string;
            //如果没有登陆 跳转到登陆
            if(role==null||role.Equals("")){
                filterContext.HttpContext.Session["message"] = "您当前没有登录，请登录！！！";
                filterContext.Result=new RedirectResult("/Home/Login");
            }
            return;
        }
    }
}